var rows3=10;


var myselfPage3;
var myselfPath3;
var myselfSucc3;

var pageEnd3;
var pageIndex3;

/***给页面分页赋值****/
function showpage_3(total,pages){
	var nowpage=Number(pages)/rows3;
	var allpage=Math.ceil(Number(total)/rows3);
	pageEnd3=allpage-1;
	pageIndex2=nowpage;
	$("#allcount_3").html(total);
	$("#rowscount_3").html(rows3);
	$("#allpage_3").html(allpage);
	$("#nowpage_3").html(nowpage+1);
	var option="";
	for(var i=0;i<allpage;i++){
		var val=i+1;
		option+="<option value='"+i+"'>"+val+"</option>"
	}
	$("#pagination_others2 select").html(option);
	$("#pagination_others2 select").val(nowpage);
}

	/**
 * 获取数据
 */
function getPageData_3(param,path,succ){
	myselfPath3=path;
	myselfPage3=param;
	myselfSucc3=succ;
   	param.ajax(path,function(data){
		showpage_3(data.total,data.page);
		succ(data);
		
		//记住当前所选的页面，目的是从其他页面再返回清单页时，保持之前所选的页面
		//window.localStorage.setItem("page",data.page);
	});
}

/**
 * 首页
 * 
 */
function firstPage_3(){
	turnPage_3("0");
}

/**
 * 最后一页
 */
function lastPage_3(){
	turnPage_3(getpageEnd_3());
}

/**
 * 上一页
 */
function prePage_3(){
	var index=getPathIndex_3()-1;
	if(index<0){
		alert("已经是首页了");
	}else{
		turnPage_3(index);
	}
}

/**
 * 下一页
 */
function nextPage_3(){

	var index=getPathIndex_3()+1;
	if(index>getpageEnd_3()){
		alert("已经是最后一页了");
	}else{
		turnPage_3(index);
	}
}

/**
 * 跳转
 */
function jumpPage_3(obj){
	var val=$(obj).val();
	turnPage_3(val);
}


/**
 * 修改page值，显示当前页数据
 * @param index
 * @return
 */
function turnPage_3(index){
	myselfPage3.json["page"]=index*rows3;
	getPageData_3(myselfPage3,myselfPath3,myselfSucc3);
}




function getPathIndex_3(){
	return pageIndex3;
}

/**
 * 最后一页
 * @return
 */
function getpageEnd_3(){
	return pageEnd3;
}
